<?php  
//    include("conn.php");
//测试成功
$hostname_conn = "localhost";
$database_conn = "xdq";
$username_conn = "root";//没改的话一般时root
$password_conn = "123456";
$conn = mysqli_connect($hostname_conn, $username_conn, $password_conn,$database_conn)or trigger_error(mysqli_error(),E_USER_ERROR);
    $lessonid = $_POST['id'];
//
    $sql = "select state from lessonKey where lessonid = '$lessonid' order by time desc";
    $result = mysqli_query($conn, $sql);
    $result = mysqli_fetch_assoc($result);//关联数组

    echo json_encode($result);

?>  